package me.ygy.agent;

import java.util.Random;
import java.util.Scanner;

public class TestClass {
    public static void main(String[] args) {
        System.out.println("按数字键 1 调用测试方法");
        while (true) {
            Scanner reader = new Scanner(System.in);
            int number = reader.nextInt();
            if (number == 1) {
                TestClass testClass = new TestClass();
                testClass.testMethod();
            }
        }
    }

    public void testMethod() {
        partOne();
        partTwo();
        partThree();
    }

    public void partOne() {
        System.out.println("exe part 1");
        try {
            Thread.sleep(new Random().nextInt(1000));
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    public void partTwo() {
        System.out.println("exe part 2");
        try {
            Thread.sleep(new Random().nextInt(2000));
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    public void partThree() {
        System.out.println("exe part 3");
        try {
            Thread.sleep(new Random().nextInt(3000));
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}